import { CommandHandler, ICommandHandler, EventBus } from '@nestjs/cqrs'
import { CreateJwtCommand } from './create-jwt.command'
import { JwtService } from '@nestjs/jwt'
@CommandHandler(CreateJwtCommand)
export class CreateJwtCommandHandler implements ICommandHandler<CreateJwtCommand>{
  constructor(
    private readonly eventBus: EventBus,
    private readonly jwtService: JwtService
  ) { }
  async execute(command: CreateJwtCommand) {
    const accessToken = this.jwtService.sign(command.params)
    return accessToken
  }
}